/*
 * Copyright (c) 2018-2999 湖南洛云网络科技有限公司 All rights reserved.
 *
 * https://www.gz-yami.com/
 *
 * 未经允许，不可做商业用途！
 *
 * 版权所有，侵权必究！
 */

package com.yami.shop.distribution.comment.service.impl;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.common.i18n.I18nMessage;
import com.yami.shop.distribution.comment.dao.DistributionUserWalletBillMapper;
import com.yami.shop.distribution.comment.dto.DistributionUserWalletBillDto;
import com.yami.shop.distribution.comment.model.DistributionUserWalletBill;
import com.yami.shop.distribution.comment.service.DistributionUserWalletBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.yaml.snakeyaml.events.Event;

import java.util.List;

/**
 * 分销员钱包流水
 * @author xwc
 * @date 2019-04-29 16:39:13
 */
@Service
public class DistributionUserWalletBillServiceImpl extends ServiceImpl<DistributionUserWalletBillMapper, DistributionUserWalletBill> implements DistributionUserWalletBillService {

    @Autowired
    DistributionUserWalletBillMapper distributionUserWalletBillMapper;

    @Override
    public Page<DistributionUserWalletBill> getDistributionUserWalletBillAndUserPage(Page page,String userMobile) {
        Page<DistributionUserWalletBill> billPage = distributionUserWalletBillMapper.getDistributionUserWalletBillAndUserPage(page, userMobile);
        List<DistributionUserWalletBill> billPageRecords = billPage.getRecords();
        if (I18nMessage.getLang() == 1) {
            for (DistributionUserWalletBill billPageRecord : billPageRecords) {
                if (billPageRecord.getRemarksEn() != null){
                    billPageRecord.setRemarks(billPageRecord.getRemarksEn());
                }
            }
        }
        return billPage;
    }

    @Override
    public Page<DistributionUserWalletBillDto> getDistributionUserWalletBillDtoPage(Page page, Long distributionUserId,Integer orderBy) {
        return distributionUserWalletBillMapper.getDistributionUserWalletBillDtoPage(page,distributionUserId,orderBy);
    }
}
